\(\int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx\) [883]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 182 \[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=-\frac {b (d \cot (e+f x))^{2+n} \operatorname {Hypergeometric2F1}\left (1,\frac {2+n}{2},\frac {4+n}{2},-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right ) d^2 f (2+n)}-\frac {a^2 (d \cot (e+f x))^{2+n} \operatorname {Hypergeometric2F1}\left (1,2+n,3+n,-\frac {a \cot (e+f x)}{b}\right )}{b \left (a^2+b^2\right ) d^2 f (2+n)}+\frac {a (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right ) d^3 f (3+n)} \]

[Out]

-b*(d*cot(f*x+e))^(2+n)*hypergeom([1, 1+1/2*n],[2+1/2*n],-cot(f*x+e)^2)/(a^2+b^2)/d^2/f/(2+n)-a^2*(d*cot(f*x+e
))^(2+n)*hypergeom([1, 2+n],[3+n],-a*cot(f*x+e)/b)/b/(a^2+b^2)/d^2/f/(2+n)+a*(d*cot(f*x+e))^(3+n)*hypergeom([1
, 3/2+1/2*n],[5/2+1/2*n],-cot(f*x+e)^2)/(a^2+b^2)/d^3/f/(3+n)

Rubi [A] (verified)

Time = 0.65 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.304, Rules used = {3754, 3655, 3619, 3557, 371, 3715, 66} \[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=\frac {a (d \cot (e+f x))^{n+3} \operatorname {Hypergeometric2F1}\left (1,\frac {n+3}{2},\frac {n+5}{2},-\cot ^2(e+f x)\right )}{d^3 f (n+3) \left (a^2+b^2\right )}-\frac {b (d \cot (e+f x))^{n+2} \operatorname {Hypergeometric2F1}\left (1,\frac {n+2}{2},\frac {n+4}{2},-\cot ^2(e+f x)\right )}{d^2 f (n+2) \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+2} \operatorname {Hypergeometric2F1}\left (1,n+2,n+3,-\frac {a \cot (e+f x)}{b}\right )}{b d^2 f (n+2) \left (a^2+b^2\right )} \]

[In]

Int[(d*Cot[e + f*x])^n/(a + b*Tan[e + f*x]),x]

[Out]

-((b*(d*Cot[e + f*x])^(2 + n)*Hypergeometric2F1[1, (2 + n)/2, (4 + n)/2, -Cot[e + f*x]^2])/((a^2 + b^2)*d^2*f*
(2 + n))) - (a^2*(d*Cot[e + f*x])^(2 + n)*Hypergeometric2F1[1, 2 + n, 3 + n, -((a*Cot[e + f*x])/b)])/(b*(a^2 +
 b^2)*d^2*f*(2 + n)) + (a*(d*Cot[e + f*x])^(3 + n)*Hypergeometric2F1[1, (3 + n)/2, (5 + n)/2, -Cot[e + f*x]^2]
)/((a^2 + b^2)*d^3*f*(3 + n))

Rule 66

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x)^(m + 1)/(b*(m + 1)))*Hypergeometr
ic2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[m] && (IntegerQ[n] || (GtQ[
c, 0] &&  !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))

Rule 371

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*((c*x)^(m + 1)/(c*(m + 1)))*Hyperg
eometric2F1[-p, (m + 1)/n, (m + 1)/n + 1, (-b)*(x^n/a)], x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rule 3557

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[b/d, Subst[Int[x^n/(b^2 + x^2), x], x, b*Tan[c + d
*x]], x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 3619

Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*T
an[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ
[c^2 + d^2, 0] &&  !IntegerQ[2*m]

Rule 3655

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)/((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/
(c^2 + d^2), Int[(a + b*Tan[e + f*x])^m*(c - d*Tan[e + f*x]), x], x] + Dist[d^2/(c^2 + d^2), Int[(a + b*Tan[e
+ f*x])^m*((1 + Tan[e + f*x]^2)/(c + d*Tan[e + f*x])), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c -
a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] &&  !IntegerQ[m]

Rule 3715

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_) + (C_.)*
tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[A/f, Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x]
 /; FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]

Rule 3754

Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_.))^(p_.), x_Symbol] :> Dist
[d^(n*p), Int[(d*Cot[e + f*x])^(m - n*p)*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x
] &&  !IntegerQ[m] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \frac {\int \frac {(d \cot (e+f x))^{1+n}}{b+a \cot (e+f x)} \, dx}{d} \\ & = \frac {\int (d \cot (e+f x))^{1+n} (b-a \cot (e+f x)) \, dx}{\left (a^2+b^2\right ) d}+\frac {a^2 \int \frac {(d \cot (e+f x))^{1+n} \left (1+\cot ^2(e+f x)\right )}{b+a \cot (e+f x)} \, dx}{\left (a^2+b^2\right ) d} \\ & = -\frac {a \int (d \cot (e+f x))^{2+n} \, dx}{\left (a^2+b^2\right ) d^2}+\frac {b \int (d \cot (e+f x))^{1+n} \, dx}{\left (a^2+b^2\right ) d}+\frac {a^2 \text {Subst}\left (\int \frac {(-d x)^{1+n}}{b-a x} \, dx,x,-\cot (e+f x)\right )}{\left (a^2+b^2\right ) d f} \\ & = -\frac {a^2 (d \cot (e+f x))^{2+n} \operatorname {Hypergeometric2F1}\left (1,2+n,3+n,-\frac {a \cot (e+f x)}{b}\right )}{b \left (a^2+b^2\right ) d^2 f (2+n)}-\frac {b \text {Subst}\left (\int \frac {x^{1+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{\left (a^2+b^2\right ) f}+\frac {a \text {Subst}\left (\int \frac {x^{2+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{\left (a^2+b^2\right ) d f} \\ & = -\frac {b (d \cot (e+f x))^{2+n} \operatorname {Hypergeometric2F1}\left (1,\frac {2+n}{2},\frac {4+n}{2},-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right ) d^2 f (2+n)}-\frac {a^2 (d \cot (e+f x))^{2+n} \operatorname {Hypergeometric2F1}\left (1,2+n,3+n,-\frac {a \cot (e+f x)}{b}\right )}{b \left (a^2+b^2\right ) d^2 f (2+n)}+\frac {a (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right ) d^3 f (3+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.59 (sec) , antiderivative size = 145, normalized size of antiderivative = 0.80 \[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=-\frac {\cot ^2(e+f x) (d \cot (e+f x))^n \left (b^2 (3+n) \operatorname {Hypergeometric2F1}\left (1,\frac {2+n}{2},\frac {4+n}{2},-\cot ^2(e+f x)\right )+a \left (a (3+n) \operatorname {Hypergeometric2F1}\left (1,2+n,3+n,-\frac {a \cot (e+f x)}{b}\right )-b (2+n) \cot (e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )\right )\right )}{b \left (a^2+b^2\right ) f (2+n) (3+n)} \]

[In]

Integrate[(d*Cot[e + f*x])^n/(a + b*Tan[e + f*x]),x]

[Out]

-((Cot[e + f*x]^2*(d*Cot[e + f*x])^n*(b^2*(3 + n)*Hypergeometric2F1[1, (2 + n)/2, (4 + n)/2, -Cot[e + f*x]^2]
+ a*(a*(3 + n)*Hypergeometric2F1[1, 2 + n, 3 + n, -((a*Cot[e + f*x])/b)] - b*(2 + n)*Cot[e + f*x]*Hypergeometr
ic2F1[1, (3 + n)/2, (5 + n)/2, -Cot[e + f*x]^2])))/(b*(a^2 + b^2)*f*(2 + n)*(3 + n)))

Maple [F]

\[\int \frac {\left (d \cot \left (f x +e \right )\right )^{n}}{a +b \tan \left (f x +e \right )}d x\]

[In]

int((d*cot(f*x+e))^n/(a+b*tan(f*x+e)),x)

[Out]

int((d*cot(f*x+e))^n/(a+b*tan(f*x+e)),x)

Fricas [F]

\[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{b \tan \left (f x + e\right ) + a} \,d x } \]

[In]

integrate((d*cot(f*x+e))^n/(a+b*tan(f*x+e)),x, algorithm="fricas")

[Out]

integral((d*cot(f*x + e))^n/(b*tan(f*x + e) + a), x)

Sympy [F]

\[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=\int \frac {\left (d \cot {\left (e + f x \right )}\right )^{n}}{a + b \tan {\left (e + f x \right )}}\, dx \]

[In]

integrate((d*cot(f*x+e))**n/(a+b*tan(f*x+e)),x)

[Out]

Integral((d*cot(e + f*x))**n/(a + b*tan(e + f*x)), x)

Maxima [F]

\[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{b \tan \left (f x + e\right ) + a} \,d x } \]

[In]

integrate((d*cot(f*x+e))^n/(a+b*tan(f*x+e)),x, algorithm="maxima")

[Out]

integrate((d*cot(f*x + e))^n/(b*tan(f*x + e) + a), x)

Giac [F]

\[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{b \tan \left (f x + e\right ) + a} \,d x } \]

[In]

integrate((d*cot(f*x+e))^n/(a+b*tan(f*x+e)),x, algorithm="giac")

[Out]

integrate((d*cot(f*x + e))^n/(b*tan(f*x + e) + a), x)

Mupad [F(-1)]

Timed out. \[ \int \frac {(d \cot (e+f x))^n}{a+b \tan (e+f x)} \, dx=\int \frac {{\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n}{a+b\,\mathrm {tan}\left (e+f\,x\right )} \,d x \]

[In]

int((d*cot(e + f*x))^n/(a + b*tan(e + f*x)),x)

[Out]

int((d*cot(e + f*x))^n/(a + b*tan(e + f*x)), x)